package model.entities;

import helpers.Utils;

import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;

@Entity
@DiscriminatorValue("5")
public class Deposito extends Area
{
	@OneToMany
	@JoinColumn(name="idArea")
	private Collection<ItemMercaderia> stock;
	
	public void solicitarMercaderia(Ingrediente ingrediente, float cantidad, AreaElaboracion areaSolicitante)
	{
		//TODO
	}
	
	public Collection<ItemMercaderia> controlarInsumosVencidos()
	{
		Collection<ItemMercaderia> rv = new ArrayList<ItemMercaderia>();
		for(ItemMercaderia item : stock)
		{
			//TODO
			if(item.estaExpirado(Utils.getFechaActual()))
			{
				rv.add(item);
			}
		}
		
		return rv;
	}
	
	public void descartasInsumos(Collection<ItemMercaderia> items)
	{
		stock.removeAll(items);
	}
}